package com.alogic.load;

import com.anysoft.util.JsonTools;
import com.anysoft.util.XmlTools;
import org.w3c.dom.Element;

import java.util.Map;

/**
 * 通用Loadable对象
 *
 * @since 1.6.13.17 [20200923 duanyy] <br>
 */
public class CommonObject extends Loadable.Abstract{
    protected String id;
    public CommonObject(String id){
        this.id = id;
    }
    @Override
    public String getId() {
        return id;
    }

    @Override
    public void report(Element xml) {
        if (xml != null){
            XmlTools.setString(xml, "module", getClass().getName());
            XmlTools.setString(xml,"id",getId());
        }
    }

    @Override
    public void report(Map<String, Object> json) {
        if (json != null){
            JsonTools.setString(json,"module",getClass().getName());
            JsonTools.setString(json,"id",getId());
        }
    }
}
